<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{$meta}
<link type="text/css" rel="stylesheet" href="{$css_path}/global.css" />
<link type="text/css" rel="stylesheet" href="{$css_path}/style.css" />
</head><body>
<!--头部--> 
{include file="top.html"}
{include file="header.html"}
<div class="p2n_detail">
  <div class="p2n_detail_left">
    <div class="p2n_detail_title"> <span id="detail_title">{$data.name}</span><span id="detail_time">发布时间：{$data.timeformat|floortime}</span> </div>
    <div class="publisher_information">
      <div class="publisher_picture"><img src="{$data.avatar_path}"/>
        <p><a href="">他的主页</a></p>
      </div>
      <div class="information_content">
        <p>联系人：{$data.username}</p>
        <p>地址：{$data.province}{$data.city}{$data.address}</p>
        <p>联系方式：{if $data.mobile_phone}手机：{$data.mobile_phone}{/if}&nbsp;{if $data.telphone}固话：{$data.telphone}{/if}</p>
        <p>悬赏金额：￥{$data.account}</p>
        <p><span id="status" value="{$data.limit_time}"></span></p>
        <p style="float:right"> <span id="msg" style="color:red"></span>&nbsp;<a href="javascript:viod(0)" class="trade_colloct" title="{$data.name}" value='{$data.id}'>我要收藏</a></p>
      </div>
      
      <div class="up_picture"><img src="{$images_path}/up_picture.png"/></div>
    </div>
    <div class="p2n_introduce">
      <div class="p2n_introduce_top">详细介绍</div>
      <div class="p2n_introduce_content">
      
      
      {$data.content}
      </div>
    </div>
    <div class="clear"></div>
    <div class="p2n_comment">
      <div class="p2n_comment_top">评&nbsp;&nbsp;论</div>
       {if $comments.total != 0}
      {foreach from=$comments.list  item=list name=l}
      <div class="p2n_comment_detail" {if $smarty.foreach.l.last}id='last_comment'{/if}>
        <div class="user_comment_pic"><img src="{$list.avatar_path}"/>
          <p><a href="">他的主页</a></p>
        </div>
        <div class="comment_list">
          <p>{$list.content}</p>
          <p id="comment_list_time">{$list.username}&nbsp;发表于{$list.add_time|floortime}</p>
        </div>
        <div class="clear"></div>
      </div>
    {/foreach}
     {else}
     	<h1 >暂无</h1>
     {/if}
     <div class="clear"></div>
     {$comments.page}
    </div>
    <div class="p2n_leave_message">
      <div class="p2n_leave_message_top">留&nbsp;&nbsp;言</div>
      <div class="p2n_leave_message_content">
      
      <form action="{$site_url}trade/comments" method="post">
            <input type="hidden" name="token" value="{$token}">
            <input type="hidden" name="trade_id" value="{$data.id}"/>
            <textarea id='answer_content' name='content' style='width:560px;height:160px;'></textarea>
            <tr>
              <th>验证码：</th>
              <td><input type='text' id='captcha' name='captcha' size='8' class='TEXT'/></td>
            </tr>
            <tr>
              <th>&nbsp;</th>
              <td> {$captcha} </td>
            </tr>
            {if count($user)>0}
            <input type='submit' value=' 我要回答 ' id="answer_click" class='rndbutton'/>
            <span class="answer_message"></span> {else} <span id='form_msg' style=''>请先登录 <a href='{$site_url}user/login'>点击这里</a></span> {/if} <br/>
            <br/>
          
          </form>
      </div>
      <div class="want_leave_message">发表留言</div>
    </div>
  </div>
  <div class="p2n_detail_right">
    <div class="whether_need">
      <p>您有什么需求吗？</p>
      <a href="">免费发布信息</a> </div>
    <div class="recommend2you_first">
      <div class="recommend_hedader">
        <h3>为您推荐</h3>
        <span><a href="#">更多>></a></span></div>
      <ul class="recommend_content">
        <li>免费网站，免费为您服务推荐</li>
        <li>免费网站，免费为您推荐服务</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您推荐服务</li>
      </ul>
    </div>
    <img src="{$images_path}/detail_bg.png" />
    <div class="recommend2you_second">
      <div class="recommend_hedader">
        <h3>猜您喜欢</h3>
        <span><a href="#">更多>></a></span></div>
      <ul class="recommend_content">
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您推荐服务</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为务为您推荐</li>
        <li>免费网站，免费为务为您推荐</li>
        <li>免费网站，免费服务为您推荐</li>
        <li>免费网站，免费为您推荐服务</li>
        <li>免费网站，免您服务为您推荐</li>
        <li>免费网站，为您服务为您推荐</li>
        <li>免费网站，为您为您推荐服务</li>
      </ul>
    </div>
    <img src="{$images_path}/detail_bg.png" /> </div>
</div>
{include file="footer.html"}
<script type="text/javascript" src="{$js_path}/message.js"></script> 
<script type="text/javascript" src="{$js_path}/jquery.validate.js"></script> 
<script type="text/javascript" src="{$js_path}/kindeditor/kindeditor-min.js"></script>
<script>
  var editor;
  KindEditor.ready(function(K) {
	  editor = K.create('#answer_content', {
		  resizeType : 0,
		  allowPreviewEmoticons : false,
		  Width : 750,
		  filterMode : false,
		  allowImageUpload : false,
		  items : [
			  'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			  'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			  'insertunorderedlist', '|', 'emoticons',  'link']
	  });
  });
</script>
<script>

$(function(){
	$.ajax({
		url:'{$site_url}trade/ajax/add_view',
		data:'id='+{$data.id},
		type:'post'
	});
	
	$('.trade_colloct').click(function(){
		var id = $(this).attr('value');
		var title = $(this).attr('title');
		
		$.ajax({
		url:'{$site_url}ajax/add_collect',
		data:'id='+id+'&type=trade&title='+title,
		type:'post',
		success:function(data){
			 $("#msg").show().html(data).fadeOut(2000);
		}		
	});
	});
	
});
      
</script>
<script type="text/javascript">
var serverTime = {$server_time} * 1000;
$(function(){
    var dateTime = new Date();
    var difference = dateTime.getTime() - serverTime;
	
    setInterval(function(){
      $("#status").each(function(){
        var obj = $(this);
        var endTime = new Date(parseInt(obj.attr('value')) * 1000);
        var nowTime = new Date();
        var nMS=endTime.getTime() - nowTime.getTime() + difference;
        var myD=Math.floor(nMS/(1000 * 60 * 60 * 24));
        var myH=Math.floor(nMS/(1000*60*60)) % 24;
        var myM=Math.floor(nMS/(1000*60)) % 60;
		var myS=Math.floor(nMS/(1000)) % 60;
        if(myD>= 0){
			var str = "还剩："+myD+"天"+myH+"小时"+myM+"分"+myS+'秒';
        }else{
			var str = "已结束！";	
		}
		
		var timeid = $(this).attr('id');
		$('#status').html(str);
      });
    }, 100);
});
</script>
</body>
</html>
